



***********************************************
** Difference of means tests (reported in text)
***********************************************

* Open data
use "PaxPopuli_Experiment.dta", replace

* Fairness - English
ttest fair if englishID == 10, by(agreed)
* Fairness - Scots
ttest fair if scottishID == 10, by(agreed)

* Decision acceptance - English
ttest accept if englishID == 10, by(agreed)
* Decision acceptance - Scots
ttest accept if scottishID == 10, by(agreed)


* Fairness - English unionists
ttest fair if englishID == 10 & inrange(scot_ind,1,2), by(agreed)
* Fairness - Scottish separatists
ttest fair if scottishID == 10 & inrange(scot_ind,4,5), by(agreed)

* Decision acceptance - English unionists
ttest accept if englishID == 10 & inrange(scot_ind,1,2), by(agreed)
* Decision acceptance - Scottish separatists
ttest accept if scottishID == 10 & inrange(scot_ind,4,5), by(agreed)




***********
** Figure 3
***********


* Fairness
use "PaxPopuli_Experiment.dta", replace
gen pos = 1 in 1/2
replace pos = 2 in 3/4
replace pos = 3 in 5/6
replace pos = 4 in 7/8
label define pos 1 "English" 2 "English & unionist" 3 "Scottish" 4 "Scottish & separatist", replace
label values pos pos

gen x = _n if pos == 1
replace x = _n - 2 if pos == 2
replace x = _n - 4 if pos == 3
replace x = _n - 6 if pos == 4

gen refagreed = 1 if x == 1
replace refagreed = 0 if x == 2

gen pe = .
gen lower = .
gen upper = .


* English identity
reg fair i.agreed if englishID == 10
local N_engl = "`e(N)'"
margins agreed, post
margins, coeflegend
replace pe =  _b[1.agreed] if pos == 1 & refagreed == 1
replace lower =  _b[1.agreed] - 1.96 * _se[1.agreed] if pos == 1 & refagreed == 1
replace upper =  _b[1.agreed] + 1.96 * _se[1.agreed] if pos == 1 & refagreed == 1
replace pe =  _b[0bn.agreed] if pos == 1 & refagreed == 0
replace lower =  _b[0bn.agreed] - 1.96 * _se[0bn.agreed] if pos == 1 & refagreed == 0
replace upper =  _b[0bn.agreed] + 1.96 * _se[0bn.agreed] if pos == 1 & refagreed == 0

* Scottish identity
reg fair i.agreed if scottishID == 10
local N_scot = "`e(N)'"
margins agreed, post
margins, coeflegend
replace pe =  _b[1.agreed] if pos == 3 & refagreed == 1
replace lower =  _b[1.agreed] - 1.96 * _se[1.agreed] if pos == 3 & refagreed == 1
replace upper =  _b[1.agreed] + 1.96 * _se[1.agreed] if pos == 3 & refagreed == 1
replace pe =  _b[0bn.agreed] if pos == 3 & refagreed == 0
replace lower =  _b[0bn.agreed] - 1.96 * _se[0bn.agreed] if pos == 3 & refagreed == 0
replace upper =  _b[0bn.agreed] + 1.96 * _se[0bn.agreed] if pos == 3 & refagreed == 0

* English unionists
reg fair i.agreed if englishID == 10 & inrange(scot_ind,1,2)
local N_engluni = "`e(N)'"
margins agreed, post
margins, coeflegend
replace pe =  _b[1.agreed] if pos == 2 & refagreed == 1
replace lower =  _b[1.agreed] - 1.96 * _se[1.agreed] if pos == 2 & refagreed == 1
replace upper =  _b[1.agreed] + 1.96 * _se[1.agreed] if pos == 2 & refagreed == 1
replace pe =  _b[0bn.agreed] if pos == 2 & refagreed == 0
replace lower =  _b[0bn.agreed] - 1.96 * _se[0bn.agreed] if pos == 2 & refagreed == 0
replace upper =  _b[0bn.agreed] + 1.96 * _se[0bn.agreed] if pos == 2 & refagreed == 0

* Scottish separatists
reg fair i.agreed if scottishID == 10 & inrange(scot_ind,4,5)
local N_scotsep = "`e(N)'"
margins agreed, post
margins, coeflegend
replace pe =  _b[1.agreed] if pos == 4 & x == 1
replace lower =  _b[1.agreed] - 1.96 * _se[1.agreed] if pos == 4 & x == 1
replace upper =  _b[1.agreed] + 1.96 * _se[1.agreed] if pos == 4 & x == 1
replace pe =  _b[0bn.agreed] if pos == 4 & x == 2
replace lower =  _b[0bn.agreed] - 1.96 * _se[0bn.agreed] if pos == 4 & x == 2
replace upper =  _b[0bn.agreed] + 1.96 * _se[0bn.agreed] if pos == 4 & x == 2


* Graph
label define pos 1 `""English" "({it:N} = `N_engl')""' 2 `""English & unionist" "({it:N} = `N_engluni')""' 3 `""Scottish" "({it:N} = `N_scot')""' 4 `""Scottish & separatist" "({it:N} = `N_scotsep')""', replace
label values pos pos
twoway (bar pe x if refagreed == 1, barwidth(1) color(edkblue)) ///
	(bar pe x if refagreed == 0, barwidth(1) color(eltblue)) ///
	(rcap lower upper x, lcolor(black)) ///
		, ///
		ytitle("") yscale(noextend nofextend) ylabel(0(2.5)10, angle(horizontal) nogrid) ///
		xtitle("") xscale(range(0 3) noline) xlabel(none, noticks) ///
		by(pos, rows(1) iscale(*1.2) noixtick title("Perceptions of fair decision-making", margin(medsmall)) note("") ///
		legend(position(6) rows(1)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))) subtitle(, color(black) fcolor(gs14) lcolor(gs14)) ///
		legend(order(1 "Mutually agreed referendum" 2 "Referendum is unilaterally initiated by Scottish government")) ///
		scheme(s2mono) xsize(4) ysize(2) graphregion(margin(medlarge)) saving(fair.gph, replace)
		
		
* Decision acceptance
use "PaxPopuli_Experiment.dta", replace

gen pos = 1 in 1/2
replace pos = 2 in 3/4
replace pos = 3 in 5/6
replace pos = 4 in 7/8
label define pos 1 "English" 2 "English & unionist" 3 "Scottish" 4 "Scottish & separatist", replace
label values pos pos

gen x = _n if pos == 1
replace x = _n - 2 if pos == 2
replace x = _n - 4 if pos == 3
replace x = _n - 6 if pos == 4

gen refagreed = 1 if x == 1
replace refagreed = 0 if x == 2

gen pe = .
gen lower = .
gen upper = .


* English identity
reg accept i.agreed if englishID == 10
local N_engl = "`e(N)'"
margins agreed, post
margins, coeflegend
replace pe =  _b[1.agreed] if pos == 1 & refagreed == 1
replace lower =  _b[1.agreed] - 1.96 * _se[1.agreed] if pos == 1 & refagreed == 1
replace upper =  _b[1.agreed] + 1.96 * _se[1.agreed] if pos == 1 & refagreed == 1
replace pe =  _b[0bn.agreed] if pos == 1 & refagreed == 0
replace lower =  _b[0bn.agreed] - 1.96 * _se[0bn.agreed] if pos == 1 & refagreed == 0
replace upper =  _b[0bn.agreed] + 1.96 * _se[0bn.agreed] if pos == 1 & refagreed == 0

* Scottish identity
reg accept i.agreed if scottishID == 10
local N_scot = "`e(N)'"
margins agreed, post
margins, coeflegend
replace pe =  _b[1.agreed] if pos == 3 & refagreed == 1
replace lower =  _b[1.agreed] - 1.96 * _se[1.agreed] if pos == 3 & refagreed == 1
replace upper =  _b[1.agreed] + 1.96 * _se[1.agreed] if pos == 3 & refagreed == 1
replace pe =  _b[0bn.agreed] if pos == 3 & refagreed == 0
replace lower =  _b[0bn.agreed] - 1.96 * _se[0bn.agreed] if pos == 3 & refagreed == 0
replace upper =  _b[0bn.agreed] + 1.96 * _se[0bn.agreed] if pos == 3 & refagreed == 0

* English unionists
reg accept i.agreed if englishID == 10 & inrange(scot_ind,1,2)
local N_engluni = "`e(N)'"
margins agreed, post
margins, coeflegend
replace pe =  _b[1.agreed] if pos == 2 & refagreed == 1
replace lower =  _b[1.agreed] - 1.96 * _se[1.agreed] if pos == 2 & refagreed == 1
replace upper =  _b[1.agreed] + 1.96 * _se[1.agreed] if pos == 2 & refagreed == 1
replace pe =  _b[0bn.agreed] if pos == 2 & refagreed == 0
replace lower =  _b[0bn.agreed] - 1.96 * _se[0bn.agreed] if pos == 2 & refagreed == 0
replace upper =  _b[0bn.agreed] + 1.96 * _se[0bn.agreed] if pos == 2 & refagreed == 0

* Scottish separatists
reg accept i.agreed if scottishID == 10 & inrange(scot_ind,4,5)
local N_scotsep = "`e(N)'"
margins agreed, post
margins, coeflegend
replace pe =  _b[1.agreed] if pos == 4 & x == 1
replace lower =  _b[1.agreed] - 1.96 * _se[1.agreed] if pos == 4 & x == 1
replace upper =  _b[1.agreed] + 1.96 * _se[1.agreed] if pos == 4 & x == 1
replace pe =  _b[0bn.agreed] if pos == 4 & x == 2
replace lower =  _b[0bn.agreed] - 1.96 * _se[0bn.agreed] if pos == 4 & x == 2
replace upper =  _b[0bn.agreed] + 1.96 * _se[0bn.agreed] if pos == 4 & x == 2


* Graph
label define pos 1 `""English" "({it:N} = `N_engl')""' 2 `""English & unionist" "({it:N} = `N_engluni')""' 3 `""Scottish" "({it:N} = `N_scot')""' 4 `""Scottish & separatist" "({it:N} = `N_scotsep')""', replace
label values pos pos
twoway (bar pe x if refagreed == 1, barwidth(1) color(edkblue)) ///
	(bar pe x if refagreed == 0, barwidth(1) color(eltblue)) ///
	(rcap lower upper x, lcolor(black)) ///
		, ///
		ytitle("") yscale(noextend nofextend) ylabel(0(2.5)10, angle(horizontal) nogrid) ///
		xtitle("") xscale(range(0 3) noline) xlabel(none, noticks) ///
		by(pos, rows(1) iscale(*1.2) noixtick title("Willingness to accept Scottish vote for independence", margin(medsmall)) note("") ///
		legend(position(6) rows(1)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))) subtitle(, color(black) fcolor(gs14) lcolor(gs14)) ///
		legend(order(1 "Mutually agreed referendum" 2 "Referendum is unilaterally initiated by Scottish government")) ///
		scheme(s2mono) xsize(4) ysize(2) graphregion(margin(medlarge)) saving(accept.gph, replace)

				
* Combine graphs
graph combine fair.gph accept.gph, rows(2) xsize(4) ysize(4) scheme(s2mono) altshrink note("Note: The spikes represent 95% confidence intervals.", span size(vsmall)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))
	

erase "fair.gph"
erase "accept.gph"	




***********
** Table S6
***********

* Open data
use "PaxPopuli_Experiment.dta", replace

gen agecat = 1 if inrange(age,18,29)
replace agecat = 2 if inrange(age,30,44)
replace agecat = 3 if inrange(age,45,59)
replace agecat = 4 if inrange(age,60,86)
label define agecat 1 "18-29" 2 "30-44" 3 "45-59" 4 "60+"
label values agecat agecat
gen lrcat = 1 if inrange(lr,0,4)
replace lrcat = 2 if lr == 5
replace lrcat = 3 if inrange(lr,6,10)
label define lrcat 1 "Leftist" 2 "Centrist" 3 "Rightist"
label values lrcat lrcat
gen highint = (pol_interest == 3)

* English identity
tab female if englishID == 10
tab agecat if englishID == 10
tab degree if englishID == 10
tab highint if englishID == 10
tab lrcat if englishID == 10
sum id if englishID == 10

* English unionist
tab female if englishID == 10 & inrange(scot_ind,1,2)
tab agecat if englishID == 10 & inrange(scot_ind,1,2)
tab degree if englishID == 10 & inrange(scot_ind,1,2)
tab highint if englishID == 10 & inrange(scot_ind,1,2)
tab lrcat if englishID == 10 & inrange(scot_ind,1,2)
sum id if englishID == 10 & inrange(scot_ind,1,2)

* Scottish identity
tab female if scottishID == 10
tab agecat if scottishID == 10
tab degree if scottishID == 10
tab highint if scottishID == 10
tab lrcat if scottishID == 10
sum id if scottishID == 10

* Scottish separatist
tab female if scottishID == 10 & inrange(scot_ind,4,5)
tab agecat if scottishID == 10 & inrange(scot_ind,4,5)
tab degree if scottishID == 10 & inrange(scot_ind,4,5)
tab highint if scottishID == 10 & inrange(scot_ind,4,5)
tab lrcat if scottishID == 10 & inrange(scot_ind,4,5)
sum id if scottishID == 10 & inrange(scot_ind,4,5)




***********
** Table S7
***********


* Open data
use "PaxPopuli_Experiment.dta", replace

* Procedural fairness
* English identity
reg fair i.agreed age female degree pol_interest lr if englishID == 10
estimates store m1
* English unionists
reg fair i.agreed age female degree pol_interest lr if englishID == 10 & inrange(scot_ind,1,2)
estimates store m2
* Scottish identity
reg fair i.agreed age female degree pol_interest lr if scottishID == 10
estimates store m3
* Scottish separatists
reg fair i.agreed age female degree pol_interest lr if scottishID == 10 & inrange(scot_ind,4,5)
estimates store m4
	
* Decision acceptance
* English identity
reg accept i.agreed age female degree pol_interest lr if englishID == 10
estimates store m5
* English unionists
reg accept i.agreed age female degree pol_interest lr if englishID == 10 & inrange(scot_ind,1,2)
estimates store m6
* Scottish identity
reg accept i.agreed age female degree pol_interest lr if scottishID == 10
estimates store m7
* Scottish separatists
reg accept i.agreed age female degree pol_interest lr if scottishID == 10 & inrange(scot_ind,4,5)
estimates store m8



************
** Table S8
************

* Open data
use "PaxPopuli_Experiment.dta", replace

* Mean total time
sum totaltime_app

* Procedural fairness
* English identity
reg fair i.agreed if englishID == 10 & totaltime_app >= 249.5
estimates store m1
* English unionists
reg fair i.agreed if englishID == 10 & inrange(scot_ind,1,2) & totaltime_app >= 249.5
estimates store m2
* Scottish identity
reg fair i.agreed if scottishID == 10 & totaltime_app >= 249.5
estimates store m3
* Scottish separatists
reg fair i.agreed if scottishID == 10 & inrange(scot_ind,4,5) & totaltime_app >= 249.5
estimates store m4
	
* Decision acceptance
* English identity
reg accept i.agreed if englishID == 10 & totaltime_app >= 249.5
estimates store m5
* English unionists
reg accept i.agreed if englishID == 10 & inrange(scot_ind,1,2) & totaltime_app >= 249.5
estimates store m6
* Scottish identity
reg accept i.agreed if scottishID == 10 & totaltime_app >= 249.5
estimates store m7
* Scottish separatists
reg accept i.agreed if scottishID == 10 & inrange(scot_ind,4,5) & totaltime_app >= 249.5
estimates store m8


	
************
** Table S9
************


* Open data
use "PaxPopuli_Experiment.dta", replace

* Procedural fairness
* English identity
reg fair i.agreed if inrange(englishID,5,10)
estimates store m1
* English unionists
reg fair i.agreed if inrange(englishID,5,10) & inrange(scot_ind,1,2)
estimates store m2
* Scottish identity
reg fair i.agreed if inrange(scottishID,5,10)
estimates store m3
* Scottish separatists
reg fair i.agreed if inrange(scottishID,5,10) & inrange(scot_ind,4,5)
estimates store m4
	
* Decision acceptance
* English identity
reg accept i.agreed if inrange(englishID,5,10)
estimates store m5
* English unionists
reg accept i.agreed if inrange(englishID,5,10) & inrange(scot_ind,1,2)
estimates store m6
* Scottish identity
reg accept i.agreed if inrange(scottishID,5,10)
estimates store m7
* Scottish separatists
reg accept i.agreed if inrange(scottishID,5,10) & inrange(scot_ind,4,5)
estimates store m8

